#include <bits/stdc++.h>
#define fi first
#define se second
typedef long long ll;
using namespace std;
int min(int a, int b, int c)
{
    int t = a < b ? a : b;
    return t < c ? t : c;
}
void solve()
{
    int a, b, c, count = 0;
    cin >> a >> b >> c;
    while (!(a == b && b == c))
    {
        int t = min(a, b, c);
        if (t == a)
        {
            a++;
            count++;
        }
        else if (t == b)
        {
            b++;
            count++;
        }
        else if (t == c)
        {
            c++;
            count++;
        }
    }
    cout << count;
}
int main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios::sync_with_stdio(false);
    int T = 1;
    // cin>>T;
    while (T--)
    {
        solve();
    }
    return 0;
}